/*
 * @lc app=leetcode.cn id=190 lang=typescript
 *
 * [190] 颠倒二进制位
 */

// @lc code=start
function reverseBits(n: number): number {
    const sec = n.toString(2);
    let result = sec.split("").reverse().join("");
    let diff = 32 - result.length;
    while (diff) {
        result = result + "0";
        diff--;
    }
    return parseInt(result, 2);
}
// @lc code=end
